<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.onload=function(){
          var oBtn=document.getElementById('btn1');
          oBtn.onclick=function(){
            alert('宽：'+document.documentElement.clientWidth+'\n高'+document.documentElement.clientHeight);
          };
        };
    </script>
</head>
<body>
<input type="button" id="btn1" value="可视区大小">
</body>
</html>